package longcaisuyun.longcai.com.yiliubabalongcaisuyun;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.zcx.helper.http.AsyCallBack;

import longcaisuyun.longcai.com.net.PostShop;


public class ShangPin_2 extends Activity {

    TextView textView5;
    GridView listView8;
    String typeid;
    String title;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shang_pin_2);
        View view = getWindow().getDecorView();
        MyApplication.ScaleScreenHelper.loadView((ViewGroup) view);
        textView5 = (TextView) findViewById(R.id.textView5);
        listView8 = (GridView) findViewById(R.id.listView8);
        typeid = getIntent().getStringExtra("typeid");
        title = getIntent().getStringExtra("title");
        textView5.setText(title);
        LinearLayout fanhui_lin = (LinearLayout) findViewById(R.id.fanhui);
        fanhui_lin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        MyApplication.myviewutil.startProgressDialog(ShangPin_2.this);
        new PostShop(typeid, new AsyCallBack<PostShop.Info>() {

            public void onFail(String toast, int type) throws Exception {
                super.onFail(toast, type);

            }


            public void onSuccess(String toast, int type, PostShop.Info info) throws Exception {
                super.onSuccess(toast, type, info);
                if (info.message.equals("1")) {
                    listView8.setAdapter(new ShopItem(ShangPin_2.this, info.list));

                } else {
                    Toast.makeText(ShangPin_2.this, "获取数据失败", Toast.LENGTH_SHORT).show();
                }
                MyApplication.myviewutil.stopProgressDialog();
            }
        }).execute(ShangPin_2.this);
    }
}
